<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>理解 price 价格语句 | Elasticsearch: 权威指南 | Elastic</title>
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
</head>
<body>
<div class="main-container">
    <section id="content">
        
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原文地址: <a href="https://www.elastic.co/guide/cn/elasticsearch/guide/current/Understanding-the-price-Clause.html" rel="nofollow">https://www.elastic.co/guide/cn/elasticsearch/guide/current/Understanding-the-price-Clause.html</a>, 版权归 www.elastic.co 所有<br/>
                            英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/guide/current/Understanding-the-price-Clause.html" rel="nofollow">https://www.elastic.co/guide/en/elasticsearch/guide/current/Understanding-the-price-Clause.html</a>
                            </div>
                        <!-- start body -->
                  <div class="page_header">
<b>请注意:</b><br>本书基于 Elasticsearch 2.x 版本，有些内容可能已经过时。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch: 权威指南</a></span>
»
<span class="breadcrumb-link"><a href="search-in-depth.html">深入搜索</a></span>
»
<span class="breadcrumb-link"><a href="controlling-relevance.html">控制相关度</a></span>
»
<span class="breadcrumb-node">理解 price 价格语句</span>
</div>
<div class="navheader">
<span class="prev">
<a href="decay-functions.html">« 越近越好</a>
</span>
<span class="next">
<a href="script-score.html">脚本评分 »</a>
</span>
</div>
<div class="section">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="Understanding-the-price-Clause"></a>理解 price 价格语句<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elasticsearch-cn/elasticsearch-definitive-guide/edit/cn/170_Relevance/60_Decay_functions.asciidoc">edit</a>
</h2>
</div></div></div>
<p><code class="literal">price</code> 语句使用了一个小技巧：用户希望选择 £100 英镑以下的度假屋，但是例子中的原点被设置成 £50 英镑，价格不能为负，但肯定是越低越好，所以 £0 到 £100 英镑内的所有价格都认为是比较好的。</p>
<p>如果我们将原点 <code class="literal">origin</code> 被设置成 £100 英镑，那么低于 £100 英镑的度假屋的评分会变低，与其这样不如将原点 <code class="literal">origin</code> 和偏移量 <code class="literal">offset</code> 同时设置成 £50 英镑，这样就能使只有在价格高于 £100 英镑（ <code class="literal">origin + offset</code> ）时评分才会变低。</p>
<div class="tip admon">
<div class="icon"></div>
<div class="admon_content">
<p><code class="literal">weight</code> 参数可以被用来调整每个语句的贡献度，权重 <code class="literal">weight</code> 的默认值是 <code class="literal">1.0</code> 。这个值会先与每个句子的评分相乘，然后再通过 <code class="literal">score_mode</code> 的设置方式合并。</p>
</div>
</div>
</div>
<div class="navfooter">
<span class="prev">
<a href="decay-functions.html">« 越近越好</a>
</span>
<span class="next">
<a href="script-score.html">脚本评分 »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>